home *** CD-ROM | disk | FTP | other *** search
- #ifdef __TURBOC__
- #include <conio.h>
- #else
- #include <conio.h>
- #include <graph.h>
- #include <dos.h>
- #endif
- #include <io.h>
- #include <process.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <dos.h>
- #include "db_types.h"
- #include "db_conio.h"
- #include "db_dos.h"
- #include "db_file.h"
- #include "db_gvar.h"
- #include "db_lsc.h"
- #include "db_str.h"
-
- bool batch, delchain;
- byte col,row,attr,savmode,newmode;
- int i, execstat;
- pathstr mbprog;
- uchar glostr[129], mbcmd[129];
- string tts;
-
- word getvmode(void)
- {
- union REGS reg;
-
- reg.h.ah = 15;
-
- /* swinterrupt(0x10,®,®); */
-
- int86(0x10, ®, ®);
- return (reg.h.al);
- }
-
- void main(void)
- {
- getscreeninfo(&savmode,&col,&row,&attr);
- db_gvar_init();
- mbcmd[0] = 0; batch = False; delchain = False;
- pointer2string(tts,dgvar);
- strconcat(glostr," ",recog,tts,NULL);
- for (i = 1; i < paramcount(); i++) {
- strcpy(tts,paramstr(i));
- if (strncmp("-AE",tts,3) == 0) delchain = False;
- if (strcmp(tts,"-BL") == 0) batch = True;
- else if ((tts[0] == '-') && (strncmp("-AE",tts,3) != 0)) strconcat(glostr,glostr," ",tts,NULL);
- else strconcat(mbcmd,mbcmd," ",tts,NULL);
- }
- if (delchain) {
- tts[0] = '_'; getenvstr(&tts[1],"MBSTN");
- unlink(strcat(tts,"LOOP.BAT"));
- }
- if (batch) {
- strcat(mbcmd,glostr);
- getenvstr(tts,"PATH");
- strconcat(tts,tts,";",thisprog.fdir,NULL);
- fsearch(mbprog,"MBRUN.EXE",tts);
- do {
- execstat = spawnlp(P_WAIT,mbprog,mbprog,mbcmd,NULL);
- if ((execstat==98) || (execstat==99)) {
- i = spawnlp(P_WAIT,gvar->prog,gvar->prog,gvar->cmd,NULL);
- strconcat(mbcmd,gvar->reentry,glostr,NULL);
- newmode = (byte)getvmode();
- if (execstat==98) {
- cwrite("\n\r");
- cwrite(LSC_PressAnyKey);
- getch();
- }
- if (savmode != newmode) textmode(savmode);
- }
- } while ((execstat == 98) || (execstat == 99));
- }
- else {
- cwrite(LSC_StartVia);
- cwrite(" STARTMB.BAT");
- }
- }
-